CC = gcc
XX = g++
TARGET = ../../bin/netcomm.so

CFLAGS = $(DEFS) -Wall -O -g -I.. -I./lib -I../../libs/lua/src -I../../libs/common -fPIC
LIBS = ../../libs/lua/src/liblua.a -lpthread -lrt -ldl
SHARED := --shared  

%.o: %.c                                 
	$(CC) $(CFLAGS) -c $< -o $@          

%.o:%.cpp
	$(XX) $(CFLAGS) -c $< -o $@

SOURCES = $(wildcard *.c *.cpp ../smartx/include/event.cpp ../smartx/include/define.cpp )
OBJS = $(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(SOURCES)))

$(TARGET) : $(OBJS)
	$(XX) $(SHARED) $(OBJS) -o $(TARGET) $(LIBS)
	chmod a+x $(TARGET)
clean:
	rm -rf $(OBJS) $(TARGET)
